<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QSortFilterProxyModel Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QSortFilterProxyModel Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QSortFilterProxyModel class provides support for sorting and
filtering data passed between another model and a view. <a href="#details">More...</a></p>

<p>Inherits <a href="qabstractproxymodel.html">QAbstractProxyModel</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#QSortFilterProxyModel">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />QModelIndex <b><a href="qsortfilterproxymodel.html#buddy">buddy</a></b> (<i>self</i>, QModelIndex&#160;<i>index</i>)</li><li><div class="fn" />bool <b><a href="qsortfilterproxymodel.html#canFetchMore">canFetchMore</a></b> (<i>self</i>, QModelIndex&#160;<i>parent</i>)</li><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qsortfilterproxymodel.html#columnCount">columnCount</a></b> (<i>self</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />QVariant <b><a href="qsortfilterproxymodel.html#data">data</a></b> (<i>self</i>, QModelIndex&#160;<i>index</i>, int&#160;<i>role</i>&#160;=&#160;Qt.DisplayRole)</li><li><div class="fn" />bool <b><a href="qsortfilterproxymodel.html#dropMimeData">dropMimeData</a></b> (<i>self</i>, QMimeData&#160;<i>data</i>, Qt.DropAction&#160;<i>action</i>, int&#160;<i>row</i>, int&#160;<i>column</i>, QModelIndex&#160;<i>parent</i>)</li><li><div class="fn" />bool <b><a href="qsortfilterproxymodel.html#dynamicSortFilter">dynamicSortFilter</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#fetchMore">fetchMore</a></b> (<i>self</i>, QModelIndex&#160;<i>parent</i>)</li><li><div class="fn" />bool <b><a href="qsortfilterproxymodel.html#filterAcceptsColumn">filterAcceptsColumn</a></b> (<i>self</i>, int&#160;<i>source_column</i>, QModelIndex&#160;<i>source_parent</i>)</li><li><div class="fn" />bool <b><a href="qsortfilterproxymodel.html#filterAcceptsRow">filterAcceptsRow</a></b> (<i>self</i>, int&#160;<i>source_row</i>, QModelIndex&#160;<i>source_parent</i>)</li><li><div class="fn" />Qt.CaseSensitivity <b><a href="qsortfilterproxymodel.html#filterCaseSensitivity">filterCaseSensitivity</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#filterChanged">filterChanged</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qsortfilterproxymodel.html#filterKeyColumn">filterKeyColumn</a></b> (<i>self</i>)</li><li><div class="fn" />QRegExp <b><a href="qsortfilterproxymodel.html#filterRegExp">filterRegExp</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qsortfilterproxymodel.html#filterRole">filterRole</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.ItemFlags <b><a href="qsortfilterproxymodel.html#flags">flags</a></b> (<i>self</i>, QModelIndex&#160;<i>index</i>)</li><li><div class="fn" />bool <b><a href="qsortfilterproxymodel.html#hasChildren">hasChildren</a></b> (<i>self</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />QVariant <b><a href="qsortfilterproxymodel.html#headerData">headerData</a></b> (<i>self</i>, int&#160;<i>section</i>, Qt.Orientation&#160;<i>orientation</i>, int&#160;<i>role</i>&#160;=&#160;Qt.EditRole)</li><li><div class="fn" />QModelIndex <b><a href="qsortfilterproxymodel.html#index">index</a></b> (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>column</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qsortfilterproxymodel.html#insertColumns">insertColumns</a></b> (<i>self</i>, int&#160;<i>column</i>, int&#160;<i>count</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qsortfilterproxymodel.html#insertRows">insertRows</a></b> (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>count</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#invalidate">invalidate</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#invalidateFilter">invalidateFilter</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsortfilterproxymodel.html#isSortLocaleAware">isSortLocaleAware</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsortfilterproxymodel.html#lessThan">lessThan</a></b> (<i>self</i>, QModelIndex&#160;<i>left</i>, QModelIndex&#160;<i>right</i>)</li><li><div class="fn" />QModelIndex <b><a href="qsortfilterproxymodel.html#mapFromSource">mapFromSource</a></b> (<i>self</i>, QModelIndex&#160;<i>sourceIndex</i>)</li><li><div class="fn" />QItemSelection <b><a href="qsortfilterproxymodel.html#mapSelectionFromSource">mapSelectionFromSource</a></b> (<i>self</i>, QItemSelection&#160;<i>sourceSelection</i>)</li><li><div class="fn" />QItemSelection <b><a href="qsortfilterproxymodel.html#mapSelectionToSource">mapSelectionToSource</a></b> (<i>self</i>, QItemSelection&#160;<i>proxySelection</i>)</li><li><div class="fn" />QModelIndex <b><a href="qsortfilterproxymodel.html#mapToSource">mapToSource</a></b> (<i>self</i>, QModelIndex&#160;<i>proxyIndex</i>)</li><li><div class="fn" />list-of-QModelIndex <b><a href="qsortfilterproxymodel.html#match">match</a></b> (<i>self</i>, QModelIndex&#160;<i>start</i>, int&#160;<i>role</i>, QVariant&#160;<i>value</i>, int&#160;<i>hits</i>&#160;=&#160;1, Qt.MatchFlags&#160;<i>flags</i>&#160;=&#160;Qt.MatchStartsWith|Qt.MatchWrap)</li><li><div class="fn" />QMimeData <b><a href="qsortfilterproxymodel.html#mimeData">mimeData</a></b> (<i>self</i>, list-of-QModelIndex&#160;<i>indexes</i>)</li><li><div class="fn" />QStringList <b><a href="qsortfilterproxymodel.html#mimeTypes">mimeTypes</a></b> (<i>self</i>)</li><li><div class="fn" />QModelIndex <b><a href="qsortfilterproxymodel.html#parent">parent</a></b> (<i>self</i>, QModelIndex&#160;<i>child</i>)</li><li><div class="fn" />QObject <b><a href="qsortfilterproxymodel.html#parent-2">parent</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsortfilterproxymodel.html#removeColumns">removeColumns</a></b> (<i>self</i>, int&#160;<i>column</i>, int&#160;<i>count</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qsortfilterproxymodel.html#removeRows">removeRows</a></b> (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>count</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />int <b><a href="qsortfilterproxymodel.html#rowCount">rowCount</a></b> (<i>self</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qsortfilterproxymodel.html#setData">setData</a></b> (<i>self</i>, QModelIndex&#160;<i>index</i>, QVariant&#160;<i>value</i>, int&#160;<i>role</i>&#160;=&#160;Qt.EditRole)</li><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#setDynamicSortFilter">setDynamicSortFilter</a></b> (<i>self</i>, bool&#160;<i>enable</i>)</li><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#setFilterCaseSensitivity">setFilterCaseSensitivity</a></b> (<i>self</i>, Qt.CaseSensitivity&#160;<i>cs</i>)</li><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#setFilterFixedString">setFilterFixedString</a></b> (<i>self</i>, QString&#160;<i>pattern</i>)</li><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#setFilterKeyColumn">setFilterKeyColumn</a></b> (<i>self</i>, int&#160;<i>column</i>)</li><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#setFilterRegExp">setFilterRegExp</a></b> (<i>self</i>, QRegExp&#160;<i>regExp</i>)</li><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#setFilterRegExp-2">setFilterRegExp</a></b> (<i>self</i>, QString&#160;<i>pattern</i>)</li><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#setFilterRole">setFilterRole</a></b> (<i>self</i>, int&#160;<i>role</i>)</li><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#setFilterWildcard">setFilterWildcard</a></b> (<i>self</i>, QString&#160;<i>pattern</i>)</li><li><div class="fn" />bool <b><a href="qsortfilterproxymodel.html#setHeaderData">setHeaderData</a></b> (<i>self</i>, int&#160;<i>section</i>, Qt.Orientation&#160;<i>orientation</i>, QVariant&#160;<i>value</i>, int&#160;<i>role</i>&#160;=&#160;Qt.EditRole)</li><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#setSortCaseSensitivity">setSortCaseSensitivity</a></b> (<i>self</i>, Qt.CaseSensitivity&#160;<i>cs</i>)</li><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#setSortLocaleAware">setSortLocaleAware</a></b> (<i>self</i>, bool&#160;<i>on</i>)</li><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#setSortRole">setSortRole</a></b> (<i>self</i>, int&#160;<i>role</i>)</li><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#setSourceModel">setSourceModel</a></b> (<i>self</i>, QAbstractItemModel&#160;<i>sourceModel</i>)</li><li><div class="fn" /><b><a href="qsortfilterproxymodel.html#sort">sort</a></b> (<i>self</i>, int&#160;<i>column</i>, Qt.SortOrder&#160;<i>order</i>&#160;=&#160;Qt.AscendingOrder)</li><li><div class="fn" />Qt.CaseSensitivity <b><a href="qsortfilterproxymodel.html#sortCaseSensitivity">sortCaseSensitivity</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qsortfilterproxymodel.html#sortColumn">sortColumn</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.SortOrder <b><a href="qsortfilterproxymodel.html#sortOrder">sortOrder</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qsortfilterproxymodel.html#sortRole">sortRole</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qsortfilterproxymodel.html#span">span</a></b> (<i>self</i>, QModelIndex&#160;<i>index</i>)</li><li><div class="fn" />Qt.DropActions <b><a href="qsortfilterproxymodel.html#supportedDropActions">supportedDropActions</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QSortFilterProxyModel class provides support for sorting and
filtering data passed between another model and a view.</p>
<p>QSortFilterProxyModel can be used for sorting items, filtering
out items, or both. The model transforms the structure of a source
model by mapping the model indexes it supplies to new indexes,
corresponding to different locations, for views to use. This
approach allows a given source model to be restructured as far as
views are concerned without requiring any transformations on the
underlying data, and without duplicating the data in memory.</p>
<p>Let's assume that we want to sort and filter the items provided
by a custom model. The code to set up the model and the view,
<i>without</i> sorting and filtering, would look like this:</p>
<pre class="cpp">
         <span class="type"><a href="qtreeview.html">QTreeView</a></span> <span class="operator">*</span>treeView <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qtreeview.html">QTreeView</a></span>;
         MyItemModel <span class="operator">*</span>model <span class="operator">=</span> <span class="keyword">new</span> MyItemModel(<span class="keyword">this</span>);

         treeView<span class="operator">-</span><span class="operator">&gt;</span>setModel(model);
</pre>
<p>To add sorting and filtering support to <tt>MyItemModel</tt>, we
need to create a QSortFilterProxyModel, call <a href="qsortfilterproxymodel.html#setSourceModel">setSourceModel</a>()
with the <tt>MyItemModel</tt> as argument, and install the
QSortFilterProxyModel on the view:</p>
<pre class="cpp">
         <span class="type"><a href="qtreeview.html">QTreeView</a></span> <span class="operator">*</span>treeView <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qtreeview.html">QTreeView</a></span>;
         MyItemModel <span class="operator">*</span>sourceModel <span class="operator">=</span> <span class="keyword">new</span> MyItemModel(<span class="keyword">this</span>);
         <span class="type">QSortFilterProxyModel</span> <span class="operator">*</span>proxyModel <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QSortFilterProxyModel</span>(<span class="keyword">this</span>);

         proxyModel<span class="operator">-</span><span class="operator">&gt;</span>setSourceModel(sourceModel);
         treeView<span class="operator">-</span><span class="operator">&gt;</span>setModel(proxyModel);
</pre>
<p>At this point, neither sorting nor filtering is enabled; the
original data is displayed in the view. Any changes made through
the QSortFilterProxyModel are applied to the original model.</p>
<p>The QSortFilterProxyModel acts as a wrapper for the original
model. If you need to convert source <a href="qmodelindex.html">QModelIndex</a>es to sorted/filtered model
indexes or vice versa, use <a href="qsortfilterproxymodel.html#mapToSource">mapToSource</a>(),
<a href="qsortfilterproxymodel.html#mapFromSource">mapFromSource</a>(),
<a href="qsortfilterproxymodel.html#mapSelectionToSource">mapSelectionToSource</a>(),
and <a href="qsortfilterproxymodel.html#mapSelectionFromSource">mapSelectionFromSource</a>().</p>
<p><b>Note:</b> By default, the model does not dynamically re-sort
and re-filter data whenever the original model changes. This
behavior can be changed by setting the <a href="qsortfilterproxymodel.html#dynamicSortFilter-prop">dynamicSortFilter</a>
property.</p>
<p>The <a href="itemviews-basicsortfiltermodel.html">Basic
Sort/Filter Model</a> and <a href="itemviews-customsortfiltermodel.html">Custom Sort/Filter Model</a>
examples illustrate how to use QSortFilterProxyModel to perform
basic sorting and filtering and how to subclass it to implement
custom behavior.</p>
<a id="sorting" name="sorting" />
<h3>Sorting</h3>
<p><a href="qtableview.html">QTableView</a> and <a href="qtreeview.html">QTreeView</a> have a <a href="qtreeview.html#sortingEnabled-prop">sortingEnabled</a> property
that controls whether the user can sort the view by clicking the
view's horizontal header. For example:</p>
<pre class="cpp">
         treeView<span class="operator">-</span><span class="operator">&gt;</span>setSortingEnabled(<span class="keyword">true</span>);
</pre>
<p>When this feature is on (the default is off), clicking on a
header section sorts the items according to that column. By
clicking repeatedly, the user can alternate between ascending and
descending order.</p>
<p class="centerAlign"><img alt="A sorted QTreeView" src="images/qsortfilterproxymodel-sorting.png" /></p>
<p>Behind the scene, the view calls the <a href="qsortfilterproxymodel.html#sort">sort</a>() virtual function on
the model to reorder the data in the model. To make your data
sortable, you can either implement <a href="qsortfilterproxymodel.html#sort">sort</a>() in your model, or use
a QSortFilterProxyModel to wrap your model -- QSortFilterProxyModel
provides a generic <a href="qsortfilterproxymodel.html#sort">sort</a>() reimplementation that
operates on the <a href="qsortfilterproxymodel.html#sortRole-prop">sortRole</a>() (<a href="qt.html#ItemDataRole-enum">Qt.DisplayRole</a> by default) of the
items and that understands several data types, including
<tt>int</tt>, <a href="qstring.html">QString</a>, and <a href="qdatetime.html">QDateTime</a>. For hierarchical models, sorting is
applied recursively to all child items. String comparisons are case
sensitive by default; this can be changed by setting the <a href="qsortfilterproxymodel.html#sortCaseSensitivity-prop">sortCaseSensitivity</a>
property.</p>
<p>Custom sorting behavior is achieved by subclassing
QSortFilterProxyModel and reimplementing <a href="qsortfilterproxymodel.html#lessThan">lessThan</a>(), which is used
to compare items. For example:</p>
<pre class="cpp">
 <span class="type">bool</span> MySortFilterProxyModel<span class="operator">.</span><a href="qsortfilterproxymodel.html#lessThan">lessThan</a>(<span class="keyword">const</span> <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> <span class="operator">&amp;</span>left<span class="operator">,</span>
                                       <span class="keyword">const</span> <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> <span class="operator">&amp;</span>right) <span class="keyword">const</span>
 {
     <span class="type"><a href="qvariant.html">QVariant</a></span> leftData <span class="operator">=</span> sourceModel()<span class="operator">-</span><span class="operator">&gt;</span>data(left);
     <span class="type"><a href="qvariant.html">QVariant</a></span> rightData <span class="operator">=</span> sourceModel()<span class="operator">-</span><span class="operator">&gt;</span>data(right);

     <span class="keyword">if</span> (leftData<span class="operator">.</span>type() <span class="operator">=</span><span class="operator">=</span> <span class="type"><a href="qvariant.html">QVariant</a></span><span class="operator">.</span>DateTime) {
         <span class="keyword">return</span> leftData<span class="operator">.</span>toDateTime() <span class="operator">&lt;</span> rightData<span class="operator">.</span>toDateTime();
     } <span class="keyword">else</span> {
         <span class="type"><a href="qregexp.html">QRegExp</a></span> <span class="operator">*</span>emailPattern <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qregexp.html">QRegExp</a></span>(<span class="string">"([\\w\\.]*@[\\w\\.]*)"</span>);

         <span class="type"><a href="qstring.html">QString</a></span> leftString <span class="operator">=</span> leftData<span class="operator">.</span>toString();
         <span class="keyword">if</span>(left<span class="operator">.</span>column() <span class="operator">=</span><span class="operator">=</span> <span class="number">1</span> <span class="operator">&amp;</span><span class="operator">&amp;</span> emailPattern<span class="operator">-</span><span class="operator">&gt;</span>indexIn(leftString) <span class="operator">!</span><span class="operator">=</span> <span class="operator">-</span><span class="number">1</span>)
             leftString <span class="operator">=</span> emailPattern<span class="operator">-</span><span class="operator">&gt;</span>cap(<span class="number">1</span>);

         <span class="type"><a href="qstring.html">QString</a></span> rightString <span class="operator">=</span> rightData<span class="operator">.</span>toString();
         <span class="keyword">if</span>(right<span class="operator">.</span>column() <span class="operator">=</span><span class="operator">=</span> <span class="number">1</span> <span class="operator">&amp;</span><span class="operator">&amp;</span> emailPattern<span class="operator">-</span><span class="operator">&gt;</span>indexIn(rightString) <span class="operator">!</span><span class="operator">=</span> <span class="operator">-</span><span class="number">1</span>)
             rightString <span class="operator">=</span> emailPattern<span class="operator">-</span><span class="operator">&gt;</span>cap(<span class="number">1</span>);

         <span class="keyword">return</span> <span class="type"><a href="qstring.html">QString</a></span><span class="operator">.</span>localeAwareCompare(leftString<span class="operator">,</span> rightString) <span class="operator">&lt;</span> <span class="number">0</span>;
     }
 }
</pre>
<p>(This code snippet comes from the <a href="itemviews-customsortfiltermodel.html">Custom Sort/Filter Model</a>
example.)</p>
<p>An alternative approach to sorting is to disable sorting on the
view and to impose a certain order to the user. This is done by
explicitly calling <a href="qsortfilterproxymodel.html#sort">sort</a>() with the desired
column and order as arguments on the QSortFilterProxyModel (or on
the original model if it implements <a href="qsortfilterproxymodel.html#sort">sort</a>()). For example:</p>
<pre class="cpp">
         proxyModel<span class="operator">-</span><span class="operator">&gt;</span>sort(<span class="number">2</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>AscendingOrder);
</pre>
<p>QSortFilterProxyModel can be sorted by column -1, in which case
it returns to the sort order of the underlying source model.</p>
<a id="filtering" name="filtering" />
<h3>Filtering</h3>
<p>In addition to sorting, QSortFilterProxyModel can be used to
hide items that do not match a certain filter. The filter is
specified using a <a href="qregexp.html">QRegExp</a> object and is
applied to the <a href="qsortfilterproxymodel.html#filterRole-prop">filterRole</a>()
(<a href="qt.html#ItemDataRole-enum">Qt.DisplayRole</a> by
default) of each item, for a given column. The <a href="qregexp.html">QRegExp</a> object can be used to match a regular
expression, a wildcard pattern, or a fixed string. For example:</p>
<pre class="cpp">
         proxyModel<span class="operator">-</span><span class="operator">&gt;</span>setFilterRegExp(<span class="type"><a href="qregexp.html">QRegExp</a></span>(<span class="string">".png"</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>CaseInsensitive<span class="operator">,</span>
                                             <span class="type"><a href="qregexp.html">QRegExp</a></span><span class="operator">.</span>FixedString));
         proxyModel<span class="operator">-</span><span class="operator">&gt;</span>setFilterKeyColumn(<span class="number">1</span>);
</pre>
<p>For hierarchical models, the filter is applied recursively to
all children. If a parent item doesn't match the filter, none of
its children will be shown.</p>
<p>A common use case is to let the user specify the filter regexp,
wildcard pattern, or fixed string in a <a href="qlineedit.html">QLineEdit</a> and to connect the <a href="qlineedit.html#textChanged">textChanged()</a> signal to <a href="qsortfilterproxymodel.html#filterRegExp-prop">setFilterRegExp</a>(),
<a href="qsortfilterproxymodel.html#setFilterWildcard">setFilterWildcard</a>(),
or <a href="qsortfilterproxymodel.html#setFilterFixedString">setFilterFixedString</a>()
to reapply the filter.</p>
<p>Custom filtering behavior can be achieved by reimplementing the
<a href="qsortfilterproxymodel.html#filterAcceptsRow">filterAcceptsRow</a>()
and <a href="qsortfilterproxymodel.html#filterAcceptsColumn">filterAcceptsColumn</a>()
functions. For example (from the <a href="itemviews-customsortfiltermodel.html">Custom Sort/Filter Model</a>
example), the following implementation ignores the <a href="qsortfilterproxymodel.html#filterKeyColumn-prop">filterKeyColumn</a>
property and performs filtering on columns 0, 1, and 2:</p>
<pre class="cpp">
 <span class="type">bool</span> MySortFilterProxyModel<span class="operator">.</span><a href="qsortfilterproxymodel.html#filterAcceptsRow">filterAcceptsRow</a>(<span class="type">int</span> sourceRow<span class="operator">,</span>
         <span class="keyword">const</span> <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> <span class="operator">&amp;</span>sourceParent) <span class="keyword">const</span>
 {
     <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> index0 <span class="operator">=</span> sourceModel()<span class="operator">-</span><span class="operator">&gt;</span>index(sourceRow<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> sourceParent);
     <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> index1 <span class="operator">=</span> sourceModel()<span class="operator">-</span><span class="operator">&gt;</span>index(sourceRow<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> sourceParent);
     <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> index2 <span class="operator">=</span> sourceModel()<span class="operator">-</span><span class="operator">&gt;</span>index(sourceRow<span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> sourceParent);

     <span class="keyword">return</span> (sourceModel()<span class="operator">-</span><span class="operator">&gt;</span>data(index0)<span class="operator">.</span>toString()<span class="operator">.</span>contains(filterRegExp())
             <span class="operator">|</span><span class="operator">|</span> sourceModel()<span class="operator">-</span><span class="operator">&gt;</span>data(index1)<span class="operator">.</span>toString()<span class="operator">.</span>contains(filterRegExp()))
            <span class="operator">&amp;</span><span class="operator">&amp;</span> dateInRange(sourceModel()<span class="operator">-</span><span class="operator">&gt;</span>data(index2)<span class="operator">.</span>toDate());
 }
</pre>
<p>(This code snippet comes from the <a href="itemviews-customsortfiltermodel.html">Custom Sort/Filter Model</a>
example.)</p>
<p>If you are working with large amounts of filtering and have to
invoke <a href="qsortfilterproxymodel.html#invalidateFilter">invalidateFilter</a>()
repeatedly, using <a href="qabstractitemmodel.html#reset">reset</a>() may be more efficient,
depending on the implementation of your model. However, <a href="qabstractitemmodel.html#reset">reset</a>() returns the proxy model
to its original state, losing selection information, and will cause
the proxy model to be repopulated.</p>
<a id="subclassing" name="subclassing" />
<h3>Subclassing</h3>
<p>Since <a href="qabstractproxymodel.html">QAbstractProxyModel</a>
and its subclasses are derived from <a href="qabstractitemmodel.html">QAbstractItemModel</a>, much of the same
advice about subclassing normal models also applies to proxy
models. In addition, it is worth noting that many of the default
implementations of functions in this class are written so that they
call the equivalent functions in the relevant source model. This
simple proxying mechanism may need to be overridden for source
models with more complex behavior; for example, if the source model
provides a custom <a href="qsortfilterproxymodel.html#hasChildren">hasChildren</a>()
implementation, you should also provide one in the proxy model.</p>
<p><b>Note:</b> Some general guidelines for subclassing models are
available in the <a href="model-view-programming.html#model-subclassing-reference">Model
Subclassing Reference</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QSortFilterProxyModel" />QSortFilterProxyModel.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a sorting filter model with the given
<i>parent</i>.</p>


<h3 class="fn"><a name="buddy" /><a href="qmodelindex.html">QModelIndex</a> QSortFilterProxyModel.buddy (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#buddy">QAbstractItemModel.buddy</a>().</p>


<h3 class="fn"><a name="canFetchMore" />bool QSortFilterProxyModel.canFetchMore (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#canFetchMore">QAbstractItemModel.canFetchMore</a>().</p>


<h3 class="fn"><a name="clear" />QSortFilterProxyModel.clear (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void clear()</tt>.</p><h3 class="fn"><a name="columnCount" />int QSortFilterProxyModel.columnCount (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#columnCount">QAbstractItemModel.columnCount</a>().</p>


<h3 class="fn"><a name="data" />QVariant QSortFilterProxyModel.data (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>, int&#160;<i>role</i>&#160;=&#160;Qt.DisplayRole)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#data">QAbstractItemModel.data</a>().</p>
<p><b>See also</b> <a href="qsortfilterproxymodel.html#setData">setData</a>().</p>


<h3 class="fn"><a name="dropMimeData" />bool QSortFilterProxyModel.dropMimeData (<i>self</i>, <a href="qmimedata.html">QMimeData</a>&#160;<i>data</i>, <a href="qt.html#DropAction-enum">Qt.DropAction</a>&#160;<i>action</i>, int&#160;<i>row</i>, int&#160;<i>column</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#dropMimeData">QAbstractItemModel.dropMimeData</a>().</p>


<h3 class="fn"><a name="dynamicSortFilter" />bool QSortFilterProxyModel.dynamicSortFilter (<i>self</i>)</h3><h3 class="fn"><a name="fetchMore" />QSortFilterProxyModel.fetchMore (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#fetchMore">QAbstractItemModel.fetchMore</a>().</p>


<h3 class="fn"><a name="filterAcceptsColumn" />bool QSortFilterProxyModel.filterAcceptsColumn (<i>self</i>, int&#160;<i>source_column</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>source_parent</i>)</h3><p>Returns true if the item in the column indicated by the given
<i>source_column</i> and <i>source_parent</i> should be included in
the model; otherwise returns false.</p>
<p>The default implementation returns true if the value held by the
relevant item matches the filter string, wildcard string or regular
expression.</p>
<p><b>Note:</b> By default, the <a href="qt.html#ItemDataRole-enum">Qt.DisplayRole</a> is used to
determine if the row should be accepted or not. This can be changed
by setting the <a href="qsortfilterproxymodel.html#filterRole-prop">filterRole</a>
property.</p>
<p><b>See also</b> <a href="qsortfilterproxymodel.html#filterAcceptsRow">filterAcceptsRow</a>(),
<a href="qsortfilterproxymodel.html#setFilterFixedString">setFilterFixedString</a>(),
<a href="qsortfilterproxymodel.html#filterRegExp-prop">setFilterRegExp</a>(),
and <a href="qsortfilterproxymodel.html#setFilterWildcard">setFilterWildcard</a>().</p>


<h3 class="fn"><a name="filterAcceptsRow" />bool QSortFilterProxyModel.filterAcceptsRow (<i>self</i>, int&#160;<i>source_row</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>source_parent</i>)</h3><p>Returns true if the item in the row indicated by the given
<i>source_row</i> and <i>source_parent</i> should be included in
the model; otherwise returns false.</p>
<p>The default implementation returns true if the value held by the
relevant item matches the filter string, wildcard string or regular
expression.</p>
<p><b>Note:</b> By default, the <a href="qt.html#ItemDataRole-enum">Qt.DisplayRole</a> is used to
determine if the row should be accepted or not. This can be changed
by setting the <a href="qsortfilterproxymodel.html#filterRole-prop">filterRole</a>
property.</p>
<p><b>See also</b> <a href="qsortfilterproxymodel.html#filterAcceptsColumn">filterAcceptsColumn</a>(),
<a href="qsortfilterproxymodel.html#setFilterFixedString">setFilterFixedString</a>(),
<a href="qsortfilterproxymodel.html#filterRegExp-prop">setFilterRegExp</a>(),
and <a href="qsortfilterproxymodel.html#setFilterWildcard">setFilterWildcard</a>().</p>


<h3 class="fn"><a name="filterCaseSensitivity" /><a href="qt.html#CaseSensitivity-enum">Qt.CaseSensitivity</a> QSortFilterProxyModel.filterCaseSensitivity (<i>self</i>)</h3><h3 class="fn"><a name="filterChanged" />QSortFilterProxyModel.filterChanged (<i>self</i>)</h3><h3 class="fn"><a name="filterKeyColumn" />int QSortFilterProxyModel.filterKeyColumn (<i>self</i>)</h3><h3 class="fn"><a name="filterRegExp" /><a href="qregexp.html">QRegExp</a> QSortFilterProxyModel.filterRegExp (<i>self</i>)</h3><h3 class="fn"><a name="filterRole" />int QSortFilterProxyModel.filterRole (<i>self</i>)</h3><h3 class="fn"><a name="flags" /><a href="qt-itemflags.html">Qt.ItemFlags</a> QSortFilterProxyModel.flags (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#flags">QAbstractItemModel.flags</a>().</p>


<h3 class="fn"><a name="hasChildren" />bool QSortFilterProxyModel.hasChildren (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#hasChildren">QAbstractItemModel.hasChildren</a>().</p>


<h3 class="fn"><a name="headerData" />QVariant QSortFilterProxyModel.headerData (<i>self</i>, int&#160;<i>section</i>, <a href="qt.html#Orientation-enum">Qt.Orientation</a>&#160;<i>orientation</i>, int&#160;<i>role</i>&#160;=&#160;Qt.EditRole)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#headerData">QAbstractItemModel.headerData</a>().</p>
<p><b>See also</b> <a href="qsortfilterproxymodel.html#setHeaderData">setHeaderData</a>().</p>


<h3 class="fn"><a name="index" /><a href="qmodelindex.html">QModelIndex</a> QSortFilterProxyModel.index (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>column</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#index">QAbstractItemModel.index</a>().</p>


<h3 class="fn"><a name="insertColumns" />bool QSortFilterProxyModel.insertColumns (<i>self</i>, int&#160;<i>column</i>, int&#160;<i>count</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#insertColumns">QAbstractItemModel.insertColumns</a>().</p>


<h3 class="fn"><a name="insertRows" />bool QSortFilterProxyModel.insertRows (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>count</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#insertRows">QAbstractItemModel.insertRows</a>().</p>


<h3 class="fn"><a name="invalidate" />QSortFilterProxyModel.invalidate (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void invalidate()</tt>.</p><p>Invalidates the current sorting and filtering.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qsortfilterproxymodel.html#invalidateFilter">invalidateFilter</a>().</p>


<h3 class="fn"><a name="invalidateFilter" />QSortFilterProxyModel.invalidateFilter (<i>self</i>)</h3><p>Invalidates the current filtering.</p>
<p>This function should be called if you are implementing custom
filtering (e.g. <a href="qsortfilterproxymodel.html#filterAcceptsRow">filterAcceptsRow</a>()),
and your filter parameters have changed.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qsortfilterproxymodel.html#invalidate">invalidate</a>().</p>


<h3 class="fn"><a name="isSortLocaleAware" />bool QSortFilterProxyModel.isSortLocaleAware (<i>self</i>)</h3><h3 class="fn"><a name="lessThan" />bool QSortFilterProxyModel.lessThan (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>left</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>right</i>)</h3><p>Returns true if the value of the item referred to by the given
index <i>left</i> is less than the value of the item referred to by
the given index <i>right</i>, otherwise returns false.</p>
<p>This function is used as the &lt; operator when sorting, and
handles the following <a href="qvariant.html">QVariant</a>
types:</p>
<ul>
<li><a href="qvariant.html#Type-enum">QVariant.Int</a></li>
<li><a href="qvariant.html#Type-enum">QVariant.UInt</a></li>
<li><a href="qvariant.html#Type-enum">QVariant.LongLong</a></li>
<li><a href="qvariant.html#Type-enum">QVariant.ULongLong</a></li>
<li><a href="qvariant.html#Type-enum">QVariant.Double</a></li>
<li><a href="qvariant.html#Type-enum">QVariant.Char</a></li>
<li><a href="qvariant.html#Type-enum">QVariant.Date</a></li>
<li><a href="qvariant.html#Type-enum">QVariant.Time</a></li>
<li><a href="qvariant.html#Type-enum">QVariant.DateTime</a></li>
<li><a href="qvariant.html#Type-enum">QVariant.String</a></li>
</ul>
<p>Any other type will be converted to a <a href="qstring.html">QString</a> using <a href="qvariant.html#toString">QVariant.toString</a>().</p>
<p>Comparison of <a href="qstring.html">QString</a>s is case
sensitive by default; this can be changed using the <a href="qsortfilterproxymodel.html#sortCaseSensitivity-prop">sortCaseSensitivity</a>
property.</p>
<p>By default, the <a href="qt.html#ItemDataRole-enum">Qt.DisplayRole</a> associated with the
<a href="qmodelindex.html">QModelIndex</a>es is used for
comparisons. This can be changed by setting the <a href="qsortfilterproxymodel.html#sortRole-prop">sortRole</a>
property.</p>
<p><b>Note:</b> The indices passed in correspond to the source
model.</p>
<p><b>See also</b> <a href="qsortfilterproxymodel.html#sortRole-prop">sortRole</a>, <a href="qsortfilterproxymodel.html#sortCaseSensitivity-prop">sortCaseSensitivity</a>,
and <a href="qsortfilterproxymodel.html#dynamicSortFilter-prop">dynamicSortFilter</a>.</p>


<h3 class="fn"><a name="mapFromSource" /><a href="qmodelindex.html">QModelIndex</a> QSortFilterProxyModel.mapFromSource (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>sourceIndex</i>)</h3><p>Reimplemented from <a href="qabstractproxymodel.html#mapFromSource">QAbstractProxyModel.mapFromSource</a>().</p>
<p>Returns the model index in the <a href="qsortfilterproxymodel.html">QSortFilterProxyModel</a> given the
<i>sourceIndex</i> from the source model.</p>
<p><b>See also</b> <a href="qsortfilterproxymodel.html#mapToSource">mapToSource</a>().</p>


<h3 class="fn"><a name="mapSelectionFromSource" /><a href="qitemselection.html">QItemSelection</a> QSortFilterProxyModel.mapSelectionFromSource (<i>self</i>, <a href="qitemselection.html">QItemSelection</a>&#160;<i>sourceSelection</i>)</h3><p>Reimplemented from <a href="qabstractproxymodel.html#mapSelectionFromSource">QAbstractProxyModel.mapSelectionFromSource</a>().</p>


<h3 class="fn"><a name="mapSelectionToSource" /><a href="qitemselection.html">QItemSelection</a> QSortFilterProxyModel.mapSelectionToSource (<i>self</i>, <a href="qitemselection.html">QItemSelection</a>&#160;<i>proxySelection</i>)</h3><p>Reimplemented from <a href="qabstractproxymodel.html#mapSelectionToSource">QAbstractProxyModel.mapSelectionToSource</a>().</p>


<h3 class="fn"><a name="mapToSource" /><a href="qmodelindex.html">QModelIndex</a> QSortFilterProxyModel.mapToSource (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>proxyIndex</i>)</h3><p>Reimplemented from <a href="qabstractproxymodel.html#mapToSource">QAbstractProxyModel.mapToSource</a>().</p>
<p>Returns the source model index corresponding to the given
<i>proxyIndex</i> from the sorting filter model.</p>
<p><b>See also</b> <a href="qsortfilterproxymodel.html#mapFromSource">mapFromSource</a>().</p>


<h3 class="fn"><a name="match" />list-of-QModelIndex QSortFilterProxyModel.match (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>start</i>, int&#160;<i>role</i>, QVariant&#160;<i>value</i>, int&#160;<i>hits</i>&#160;=&#160;1, <a href="qt-matchflags.html">Qt.MatchFlags</a>&#160;<i>flags</i>&#160;=&#160;Qt.MatchStartsWith|Qt.MatchWrap)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#match">QAbstractItemModel.match</a>().</p>


<h3 class="fn"><a name="mimeData" /><a href="qmimedata.html">QMimeData</a> QSortFilterProxyModel.mimeData (<i>self</i>, list-of-QModelIndex&#160;<i>indexes</i>)</h3><p>The <i>QMimeData</i> result</p><p>Reimplemented from <a href="qabstractitemmodel.html#mimeData">QAbstractItemModel.mimeData</a>().</p>


<h3 class="fn"><a name="mimeTypes" />QStringList QSortFilterProxyModel.mimeTypes (<i>self</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#mimeTypes">QAbstractItemModel.mimeTypes</a>().</p>


<h3 class="fn"><a name="parent" /><a href="qmodelindex.html">QModelIndex</a> QSortFilterProxyModel.parent (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>child</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#parent">QAbstractItemModel.parent</a>().</p>


<h3 class="fn"><a name="parent-2" /><a href="qobject.html">QObject</a> QSortFilterProxyModel.parent (<i>self</i>)</h3><h3 class="fn"><a name="removeColumns" />bool QSortFilterProxyModel.removeColumns (<i>self</i>, int&#160;<i>column</i>, int&#160;<i>count</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#removeColumns">QAbstractItemModel.removeColumns</a>().</p>


<h3 class="fn"><a name="removeRows" />bool QSortFilterProxyModel.removeRows (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>count</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#removeRows">QAbstractItemModel.removeRows</a>().</p>


<h3 class="fn"><a name="rowCount" />int QSortFilterProxyModel.rowCount (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#rowCount">QAbstractItemModel.rowCount</a>().</p>


<h3 class="fn"><a name="setData" />bool QSortFilterProxyModel.setData (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>, QVariant&#160;<i>value</i>, int&#160;<i>role</i>&#160;=&#160;Qt.EditRole)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#setData">QAbstractItemModel.setData</a>().</p>
<p><b>See also</b> <a href="qsortfilterproxymodel.html#data">data</a>().</p>


<h3 class="fn"><a name="setDynamicSortFilter" />QSortFilterProxyModel.setDynamicSortFilter (<i>self</i>, bool&#160;<i>enable</i>)</h3><h3 class="fn"><a name="setFilterCaseSensitivity" />QSortFilterProxyModel.setFilterCaseSensitivity (<i>self</i>, <a href="qt.html#CaseSensitivity-enum">Qt.CaseSensitivity</a>&#160;<i>cs</i>)</h3><h3 class="fn"><a name="setFilterFixedString" />QSortFilterProxyModel.setFilterFixedString (<i>self</i>, QString&#160;<i>pattern</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setFilterFixedString(const QString&amp;)</tt>.</p><p>Sets the fixed string used to filter the contents of the source
model to the given <i>pattern</i>.</p>
<p><b>See also</b> <a href="qsortfilterproxymodel.html#filterCaseSensitivity-prop">setFilterCaseSensitivity</a>(),
<a href="qsortfilterproxymodel.html#filterRegExp-prop">setFilterRegExp</a>(),
<a href="qsortfilterproxymodel.html#setFilterWildcard">setFilterWildcard</a>(),
and <a href="qsortfilterproxymodel.html#filterRegExp-prop">filterRegExp</a>().</p>


<h3 class="fn"><a name="setFilterKeyColumn" />QSortFilterProxyModel.setFilterKeyColumn (<i>self</i>, int&#160;<i>column</i>)</h3><h3 class="fn"><a name="setFilterRegExp" />QSortFilterProxyModel.setFilterRegExp (<i>self</i>, <a href="qregexp.html">QRegExp</a>&#160;<i>regExp</i>)</h3><h3 class="fn"><a name="setFilterRegExp-2" />QSortFilterProxyModel.setFilterRegExp (<i>self</i>, QString&#160;<i>pattern</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setFilterRegExp(const QString&amp;)</tt>.</p><h3 class="fn"><a name="setFilterRole" />QSortFilterProxyModel.setFilterRole (<i>self</i>, int&#160;<i>role</i>)</h3><h3 class="fn"><a name="setFilterWildcard" />QSortFilterProxyModel.setFilterWildcard (<i>self</i>, QString&#160;<i>pattern</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setFilterWildcard(const QString&amp;)</tt>.</p><p>Sets the wildcard expression used to filter the contents of the
source model to the given <i>pattern</i>.</p>
<p><b>See also</b> <a href="qsortfilterproxymodel.html#filterCaseSensitivity-prop">setFilterCaseSensitivity</a>(),
<a href="qsortfilterproxymodel.html#filterRegExp-prop">setFilterRegExp</a>(),
<a href="qsortfilterproxymodel.html#setFilterFixedString">setFilterFixedString</a>(),
and <a href="qsortfilterproxymodel.html#filterRegExp-prop">filterRegExp</a>().</p>


<h3 class="fn"><a name="setHeaderData" />bool QSortFilterProxyModel.setHeaderData (<i>self</i>, int&#160;<i>section</i>, <a href="qt.html#Orientation-enum">Qt.Orientation</a>&#160;<i>orientation</i>, QVariant&#160;<i>value</i>, int&#160;<i>role</i>&#160;=&#160;Qt.EditRole)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#setHeaderData">QAbstractItemModel.setHeaderData</a>().</p>
<p><b>See also</b> <a href="qsortfilterproxymodel.html#headerData">headerData</a>().</p>


<h3 class="fn"><a name="setSortCaseSensitivity" />QSortFilterProxyModel.setSortCaseSensitivity (<i>self</i>, <a href="qt.html#CaseSensitivity-enum">Qt.CaseSensitivity</a>&#160;<i>cs</i>)</h3><h3 class="fn"><a name="setSortLocaleAware" />QSortFilterProxyModel.setSortLocaleAware (<i>self</i>, bool&#160;<i>on</i>)</h3><h3 class="fn"><a name="setSortRole" />QSortFilterProxyModel.setSortRole (<i>self</i>, int&#160;<i>role</i>)</h3><h3 class="fn"><a name="setSourceModel" />QSortFilterProxyModel.setSourceModel (<i>self</i>, <a href="qabstractitemmodel.html">QAbstractItemModel</a>&#160;<i>sourceModel</i>)</h3><p>Reimplemented from <a href="qabstractproxymodel.html#setSourceModel">QAbstractProxyModel.setSourceModel</a>().</p>


<h3 class="fn"><a name="sort" />QSortFilterProxyModel.sort (<i>self</i>, int&#160;<i>column</i>, <a href="qt.html#SortOrder-enum">Qt.SortOrder</a>&#160;<i>order</i>&#160;=&#160;Qt.AscendingOrder)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#sort">QAbstractItemModel.sort</a>().</p>


<h3 class="fn"><a name="sortCaseSensitivity" /><a href="qt.html#CaseSensitivity-enum">Qt.CaseSensitivity</a> QSortFilterProxyModel.sortCaseSensitivity (<i>self</i>)</h3><h3 class="fn"><a name="sortColumn" />int QSortFilterProxyModel.sortColumn (<i>self</i>)</h3><p>the column currently used for sorting</p>
<p>This returns the most recently used sort column.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="sortOrder" /><a href="qt.html#SortOrder-enum">Qt.SortOrder</a> QSortFilterProxyModel.sortOrder (<i>self</i>)</h3><p>the order currently used for sorting</p>
<p>This returns the most recently used sort order.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="sortRole" />int QSortFilterProxyModel.sortRole (<i>self</i>)</h3><h3 class="fn"><a name="span" /><a href="qsize.html">QSize</a> QSortFilterProxyModel.span (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#span">QAbstractItemModel.span</a>().</p>


<h3 class="fn"><a name="supportedDropActions" /><a href="qt-dropactions.html">Qt.DropActions</a> QSortFilterProxyModel.supportedDropActions (<i>self</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#supportedDropActions">QAbstractItemModel.supportedDropActions</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>